<template>
  <view class="page" :style="themeColor">
    <!---logoflex布局开始-->
    <view class="flex flex-direction flex-wrap align-center justify-center benben-flex-layout passwordLogin_flex_0">
      <image class='passwordLogin_fd0_0' mode="aspectFit" :src='STATIC_URL+"28.png"'></image>
    </view>
    <!---logoflex布局结束-->
    <!---flex布局flex布局开始-->
    <view class="flex flex-direction flex-wrap align-stretch benben-flex-layout passwordLogin_flex_1">
      <view class='flex flex-wrap align-center passwordLogin_fd1_0'>
        <image class='passwordLogin_fd1_0_c0' mode="aspectFit" :src='STATIC_URL+"29.png"'></image>
        <input class='flex-sub passwordLogin_fd1_0_c1' type="number" placeholder="请输入手机号" confirm-type="done"
          :maxlength="11" placeholder-style="color:rgba(191, 191, 191, 1);font-size:32rpx" v-model="mobile" />
      </view>
      <view class='flex flex-wrap align-center passwordLogin_fd1_1'>
        <image class='passwordLogin_fd1_1_c0' mode="aspectFit" :src='STATIC_URL+"30.png"'></image>
        <benben-flex-password-diy v-model="password" class-name="flex align-center flex passwordLogin_fd1_1_c1"
          :placeholder="'请输入密码(6~12位字母+数字)'" :maxlength="12" :default-type='true'
          placeholder-style="color:rgba(191, 191, 191, 1);font-size:32rpx">
          <template #show>
            <text class='fu-iconfont2  passwordLogin_fd1_1_c1_icon1' data-type="show">&#xE837;</text>
          </template>
          <template #hide>
            <text class='fu-iconfont2  passwordLogin_fd1_1_c1_icon2' data-type="hide">&#xEBCC;</text>
          </template>
        </benben-flex-password-diy>
      </view>
      <text class='passwordLogin_fd1_2' @tap.stop="handleJumpDiy" data-type="redirectTo"
        :data-url="`/pages/tabBar/login/login`">验证码登录</text>
      <view class='flex flex-wrap align-center justify-center'>
        <button class='passwordLogin_fd1_3_c0' @tap.stop="LoginFunc()">登录</button>
      </view>
      <view class='flex flex-wrap align-center justify-center passwordLogin_fd1_4'>
        <text class='passwordLogin_fd1_4_c0' @tap.stop="handleJumpDiy" data-type="navigateTo"
          :data-url="`/pages/dlzc/registerLogin/registerLogin`">注册账号</text>
        <text class='passwordLogin_fd1_4_c1'>|</text>
        <text class='passwordLogin_fd1_4_c2' @tap.stop="handleJumpDiy" data-type="navigateTo"
          :data-url="`/pages/dlzc/forgetPasw/forgetPasw`"> 忘记密码</text>
      </view>
      <view class="flex flex-wrap align-center justify-center benben-position-layout flex registers_flex_3">
        <benben-flex-switch-new class-name='flex flex' v-model="is_tick" :disabled='false'>
          <template v-slot:checked>

            <view class='flex flex position-relative align-center'>
              <image class='registers_checkfd3_0_c0_c0' mode="aspectFit" :src='STATIC_URL+"26.png"'></image>
            </view>

          </template>
          <template v-slot:unchecked>

            <view class='flex flex position-relative justify-end align-center'>
              <image class='registers_noCheckfd3_0_c1_c0' mode="aspectFit" :src='STATIC_URL+"27.png"'></image>
            </view>

          </template>
        </benben-flex-switch-new>
        <text class='registers_fd3_1'>请阅读并同意</text>
        <text class='registers_fd3_2' @tap.stop="handleJumpDiy" data-type="navigateTo"
          :data-url="`/pages/dlzc/agreements/agreements`">《用户注册协议》</text>
        <text class='registers_fd3_3'>与</text>
        <text class='registers_fd3_4' @tap.stop="handleJumpDiy" data-type="navigateTo"
          :data-url="`/pages/dlzc/privacyPolicy/privacyPolicy`">《隐私政策》</text>
      </view>
    </view>
    <!---flex布局flex布局结束-->
    <!-- <view :style="{height: '113rpx'}"></view> -->
  </view>
</template>
<script>
  import {
    validate
  } from '@/common/utils/validate.js'
  export default {
    components: {},

    data() {
      return {
        "mobile": "",
        "password": "",
        "is_tick": false,
        "data": {
          "userinfo": {
            "user_token": "",
            "id": "",
            "head_img": "",
            "user_name": "",
            "user_nickname": "",
            "sex": "",
            "user_type": "",
            "user_level": "",
            "mobile": "",
            "birthday": "",
            "address": "",
            "address_code": ""
          }
        }
      };
    },
    computed: {
      themeColor() {
        return this.$store.getters.themeColor
      },

    },
    watch: {},
    onLoad(options) {
      this.mobile = options.mobile
    },
    onUnload() {

    },
    onReady() {

    },
    onShow() {

    },
    onHide() {

    },
    onResize() {

    },
    onPullDownRefresh() {

    },
    onReachBottom(e) {

    },
    onPageScroll(e) {

    },
    methods: {
      //密码登录
      async LoginFunc() {
        if (!validate(this.mobile, 'require')) {
          this.$message.info('手机号不能为空');
          return false;
        }
        if (!validate(this.mobile, 'phone')) {
          this.$message.info('请输入正确的手机号');
          return false;
        }
        if (!validate(this.password, 'require')) {
          this.$message.info('请输入密码');
          return false;
        }
        if (!validate(this.password, 'password')) {
          this.$message.info('请输入字母加数字6-12位密码');
          return false;
        }
        if (!(this.is_tick === true)) {
          this.$message.info('请阅读并同意《用户注册协议》与《隐私政策》');
          return false;
        }
        //请求方法
        //数据验证

        let datadata = await this.$api.post(global.apiUrls.post5c78dbfd977cf, {
          account: this.mobile,
          account_type: 'mobile',
          password: this.password
        });
        if (datadata.data.code != 1) {
          this.$message.info(datadata.data.msg);
          return
        }
        let infodata = datadata.data;
        this.data = infodata.data
        this.$store.commit('updateUserInfo', this.data.userinfo)
        this.$store.commit('saveToken', this.data.userinfo.user_token)
        let clientId = ''
        // #ifdef APP-PLUS
        clientId = plus.push.getClientInfo().clientid || '';
        // #endif
        this.$api.post(global.apiUrls.post5cb54af125f1c, {
          client_id: clientId
        }).then(reult => {
          console.log('global.apiUrls.5cb54af125f1c')
        })
        this.$urouter.reLaunch(`/pages/tabBar/index/index`);
      }
    }
  };
</script>
<style lang="scss" scoped>
  .registers_flex_3 {
    background: #fff;
    // background-size: 100% !important;
    // width: 750rpx;
    text-align: center;
    height: 113rpx;
    overflow: hidden;
    z-index: 10;
    margin-left: 40rpx;
    bottom: calc(0rpx + var(--window-bottom));
    // background-size: 100%  auto !important;
  }

  .registers_fd3_4 {
    line-height: 32rpx;
    font-size: 24rpx;
    font-weight: 400;
    color: rgba(37, 104, 174, 1);
  }

  .registers_fd3_3 {
    line-height: 32rpx;
    font-size: 24rpx;
    font-weight: 400;
    color: rgba(153, 153, 153, 1);
  }

  .registers_fd3_2 {
    line-height: 32rpx;
    font-size: 24rpx;
    font-weight: 400;
    color: rgba(37, 104, 174, 1);
  }

  .registers_fd3_1 {
    line-height: 32rpx;
    font-size: 22rpx;
    font-weight: 400;
    color: rgba(153, 153, 153, 1);
    margin: 0rpx 0rpx 0rpx 12rpx;
  }

  .registers_noCheckfd3_0_c1_c0 {
    height: 24rpx;
    width: 24rpx;
  }

  .registers_checkfd3_0_c0_c0 {
    width: 24rpx;
    height: 24rpx;
  }

  .page {
    width: 100vw;
    overflow-x: hidden;
    min-height: calc(100vh - var(--window-bottom));
    background: #fff;
    background-size: 100% auto !important;
  }

  .passwordLogin_flex_0 {
    padding: 200rpx 0rpx 0rpx 0rpx;
  }

  .passwordLogin_fd0_0 {
    width: 180rpx;
    height: 180rpx;
    border-radius: 48rpx 48rpx 48rpx 48rpx;
  }

  .passwordLogin_flex_1 {
    padding: 80rpx 56rpx 0rpx 56rpx;
  }

  .passwordLogin_fd1_4_c2 {
    color: #999999;
    font-size: 28rpx;
    font-weight: 400;
    line-height: 40rpx;
  }

  .passwordLogin_fd1_4_c1 {
    margin: 0rpx 20rpx 0rpx 20rpx;
    color: #999999;
    font-size: 28rpx;
    font-weight: 400;
    line-height: 40rpx;
  }

  .passwordLogin_fd1_4_c0 {
    color: #999999;
    font-size: 28rpx;
    font-weight: 400;
    line-height: 40rpx;
  }

  .passwordLogin_fd1_4 {
    margin: 40rpx 0rpx 0rpx 0rpx;
    color: #999999;
    font-size: 28rpx;
    line-height: 34rpx;
    font-weight: 400;
  }

  .passwordLogin_fd1_3_c0 {
    color: rgba(37, 104, 174, 1);
    background-size: 100% !important;
    border-radius: 44rpx 44rpx 44rpx 44rpx;
    font-size: 32rpx;
    color: #fff;
    height: 88rpx;
    line-height: 88rpx;
    width: 638rpx;
    font-weight: 500;
    background-color: rgba(37, 104, 174, 1);

  }

  .passwordLogin_fd1_2 {
    margin: 32rpx 0rpx 48rpx 0rpx;
    line-height: 34rpx;
    font-size: 28rpx;
    font-weight: 400;
    color: #333333;
    text-align: right;
  }

  .passwordLogin_fd1_1_c1_icon2 {
    width: 88rpx;
    line-height: 88rpx;
    text-align: center;
    font-size: 40rpx;
  }

  .passwordLogin_fd1_1_c1_icon1 {
    width: 88rpx;
    line-height: 88rpx;
    text-align: center;
    font-size: 40rpx;
  }

  ::v-deep .passwordLogin_fd1_1_c1 {
    height: 125rpx;
    width: 580rpx;
    font-size: 32rpx;
    font-weight: 400;
    color: #333;
  }

  .passwordLogin_fd1_1_c0 {
    width: 34rpx;
    height: 34rpx;
    border-radius: 0rpx 0rpx 0rpx 0rpx;
    margin: 0rpx 16rpx 0rpx 0rpx;
  }

  .passwordLogin_fd1_1 {
    border-bottom: 1px solid #eee;
    background: rgba(255, 255, 255, 0.39);
    background-size: 100% !important;
    height: 125rpx;
  }

  .passwordLogin_fd1_0_c1 {
    line-height: 125rpx;
    font-size: 32rpx;
    font-weight: 400;
    color: #333;
    text-decoration: none;
    height: 125rpx;
  }

  .passwordLogin_fd1_0_c0 {
    width: 34rpx;
    height: 34rpx;
    border-radius: 0rpx 0rpx 0rpx 0rpx;
    margin: 0rpx 16rpx 0rpx 0rpx;
  }

  .passwordLogin_fd1_0 {
    border-bottom: 1px solid rgba(238, 238, 238, 1);
    background: rgba(255, 255, 255, 0.39);
    background-size: 100% !important;
    height: 125rpx;
  }
</style>
